﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TrainingsApp.WebModel;
using TrainingsApp.Model;

namespace TrainingsApp.IPADApp.UserControls.Main.Teacher {
    public partial class UC_Index : AccountControl {
        protected void Page_Load(object sender, EventArgs e) {
            List<TS_Preview_Entity> previews = TrainingsApp.Logic.TS_Preview_Logic.TS_Preview_Result_TopByTeacher(this.CurPage.CurrentUser.UserID);

            if (previews != null && previews.Count > 0) {
                var entity = previews.First();
                this.ltPreviewTip.Text = string.Format(@"您{0}发布了前概念问题，已有<a href=""javascript:void(0)"" >{1}</a>位同学对这个问题表达了前概念。", entity.PublishDate.ToString("yyyy-MM-dd"), previews.Sum(u => u.ReferenceTotal));
                this.rptPrevoewQuestion.DataSource = previews;
                this.rptPrevoewQuestion.DataBind();
            }
            else {
                this.ltPreviewTip.Text = "&nbsp;";
            }
        }
    }
}